package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.ICompanyService;
import com.cn.wanxi.service.INavService;
import com.cn.wanxi.service.NavService;
import com.cn.wanxi.service.impl.CompanyServiceImpl;
import com.cn.wanxi.service.impl.NavServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

public class CompanyAndNavForThreeServlet {
    public static void setCompanyAndNavData(HttpServletRequest req) {
        //        CompanyModel companyModel = new CompanyModel();
        ICompanyService companyService = new CompanyServiceImpl();
        CompanyModel companyModel = companyService.getCompanyModel();
//        动态的：低耦合，引入接口
//        List<NavModel> navModelList = new ArrayList<>();
//        NavService navService = new NavService();
        INavService iNavService=new NavServiceImpl();
        List<NavModel>   navModelList = iNavService.getNavModelList();
        req.setAttribute("navModelList", navModelList);
        req.setAttribute("companyModel", companyModel);



    }
}
